package com.mobile.config;

import com.itheima.common.utils.SMSUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Encounter
 * @date 2024/10/14 11:49<br/>
 */
@Slf4j
@Configuration
public class SMSConfiguration
    {
        
        @Bean
        @ConditionalOnMissingBean
        public SMSUtils sMSUtil(AliSMSProperties aliSMSProperties)
            {
                log.info("开始创建阿里短信服务工具类对象：{}", aliSMSProperties);
                return new SMSUtils(aliSMSProperties.getValidateCode(),
                        aliSMSProperties.getOrderNotice(),
                        aliSMSProperties.getAccessKeyId(),
                        aliSMSProperties.getAccessKeySecret(),
                        aliSMSProperties.getSignName());
            }
        
    }